#include <iostream>

using namespace std;

//#define DEBUG

//扩展欧里几得算法
// pa + qb = gcd(a, b);
// 通过exGcd求出一个角 p0, q0
// 那么其它解为 p0 + b / gcd(a, b) * t q0 - a / gcd(a, b) * t

// 对pa + qb = c 来说
// 若 c % gcd(a, b) == 0 则等式有解，否则无解
// p0 q0 为 pa + qb = gcd(a, b)的一个解
// 则 p1 = po * c / gcd(a, b)  q1 = q0 * c / gcd(a, b)是它的一组解
// 其它组解为 p1 + b / gcd(a, b) * t, q1 - a / gcd(a, b) * t

long long x, y, m, n, L;

long long gcd(long long a, long long b)
{
    while(b != 0)
    {
        long long  r = b;
        b = a % b;
        a = r;
    }
    return a;
}

// 形如ax+by = gcd(a, b);求一级x, y
long long exGcd(long long a, long long b, long long& x, long long& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long r = exGcd(b, a%b, x, y);
    long long t = x;
    x = y;
    y = t - a/b * y;
    return r;
}

int main() {
    cin >> x >> y >> m >> n >> L;
    {

        long long a = m-n ;
        long long b = L;
        long long  c = y-x ;
        if (a < 0) {
            a = -a;
            c = -c;
        }
        if (b < 0) {
            b = -b;
        }
        long long gcd_ab = gcd(a, b);
#ifdef DEBUG
        cout << "x, y, m, n, L: " 
            << x <<  " " << y << " " 
            <<  m  << " " << n << " " 
            << L << endl;
        cout << "a: " << a << " b: " << b << " c: " << c 
            << " gcd(a, b): " << gcd_ab << endl;
#endif

        if (c % gcd_ab == 0) {//有解

            long long p, q;
            exGcd(a, b, p, q);
#ifdef DEBUG
            cout << "p: " << p << " q: " << q << endl;
#endif
            p = p * (c / gcd_ab);
            //cout << p << endl;

            long long minp = p % (b / gcd_ab);
            if (minp < 0) {
                minp += b / gcd_ab;
            }
            cout << minp << endl;



        } 
        else { //无解
            cout << "Impossible" << endl;
        }


    }
    return 0;
}
